﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace AVCWizard
{
    /// <summary>
    /// Interaktionslogik für AppSettings.xaml
    /// </summary>
    public partial class AppSettings : Window
    {
        public AppConfig Cfg { get; set; }

        public AppSettings()
        {
            Cfg = MainWindow.Config.Current.AppCfg.Clone() as AppConfig;
            Language[] lang = DictionaryLoader.LoadLanguages(StaticExt.AssemblyPath(StaticExt.LangFileName));
            InitializeComponent();
            LanguageComboBox.Items.AddRangeSafe(lang);
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if (LanguageComboBox.SelectedItem != null)
            {
                Cfg.LanguageId = ((Language)LanguageComboBox.SelectedItem).Id;
            }
            DialogResult = true;
        }

        private void BrowseFFMpegButton_Click(object sender, RoutedEventArgs e)
        {
            string path = DialogTool.BrowseFolder(MainWindow.Translation["FFPathBrowse"]);
            if (path != null)
            {
                Cfg.FFMpegPath = path;
            }
        }

        private void BrowseOutputButton_Click(object sender, RoutedEventArgs e)
        {
            string path = DialogTool.BrowseFolder(MainWindow.Translation["OutPathBrowse"]);
            if (path != null)
            {
                Cfg.TargetFolder = path;
            }
        }

        public Dictionary<string, string> LocalTrans
        {
            get { return MainWindow.Translation; }
        }
    }
}
